package book.ch11;

import java.sql.*;

public class MyDBShow {
    public static void main(String[] args)  {
        String uri="jdbc:mysql://127.0.0.1:3306/stuinfo?"+
                "useSSL=true&serverTimezone=CST";
        String user="root";
        String password="123456";
        try{



        Connection con= DriverManager.getConnection(uri,user,password);
        Statement sql=con.createStatement();
        ResultSet rs=sql.executeQuery("select * from 21infoandmang.stu_info");
        //con.close();
        //rs.get
        while(rs.next()){
            String number=rs.getNString(2);
            System.out.println(number);
            int id=rs.getInt(1);
            System.out.println(id);
            String name=rs.getNString(3);
            System.out.println(name);
        }
        }catch(SQLException e){
            System.out.println("SQL ERROR");
        }

    }
}
